import { info, err } from "../middleware/infoerr";
import { Request, Response, NextFunction } from "express";
import ArticleSer from "../../services/ArticleSer";

export async function getTimeTop(
  req: Request,
  res: Response,
  next: NextFunction
) {
  try {
    req.query = req.query as any;
    const data = await ArticleSer.getTimeTop(
      req.query.x as unknown as number,
      req.query.y as unknown as number,
      req.query.z as unknown as number
    );
    return info(res, "ok", data);
  } catch (error) {
    next(error);
  }
}
export async function getBrowesNumTop(
  req: Request,
  res: Response,
  next: NextFunction
) {
  try {
    req.query = req.query as any;
    const data = await ArticleSer.getBrowesNumTop(
      req.query.x as unknown as number,
      req.query.y as unknown as number,
      req.query.z as unknown as number
    );
    return info(res, "ok", data);
  } catch (error) {
    next(error);
  }
}
